package com.zqh.myfmmall.fallback;

import com.zqh.myfmmall.clients.ProductSkuQueryClient;
import com.zqh.myfmmall.result.Result;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-03-17 11:16
 */
@Slf4j
public class ProductSkuQueryClientFallback implements FallbackFactory<ProductSkuQueryClient>{
    @Override
    public ProductSkuQueryClient create(Throwable cause) {
        log.warn(""+cause);
        return new ProductSkuQueryClient(){
            @Override
            public Result getByIds(List<String> ids) {
                return Result.internalServerError();
            }

            @Override
            public Result getStockByIds(List<String> ids) {
                return Result.internalServerError();

            }

            @Override
            public Result getByPorductId(String productId) {
                return Result.internalServerError();

            }

            @Override
            public Result getProductsLowestPrice(List<String> productIds) {
                return Result.internalServerError();

            }
        };
    }
}
